package czk.concrent.juc.countDOwnLatch;

import java.util.concurrent.ThreadLocalRandom;

/**
 * 随机点名器
 *
 * @Author:ChenZhangKun
 * @Date: 2021/9/17 15:17
 */
public class RandomName {
    public static void main(String[] args) {
        String[] names = {"陈彰坤", "郭瑞广", "张忠敬", "葛小祥", "卿雨林"};
        boolean flag = true;
        // 虚幻三秒
        Long end = System.currentTimeMillis() + 10 * 1000;
        while (flag) {
            Long current = System.currentTimeMillis();
            if (end < current) {
                flag = false;
            }
            System.out.print("\r" + names[ThreadLocalRandom.current().nextInt(5)]+"   "+names[ThreadLocalRandom.current().nextInt(5)]);
        }
    }
}
